package com.gulimall.product.web;

import com.gulimall.common.vo.LoginInfo;
import com.gulimall.product.service.CategoryService;
import com.gulimall.product.vo.Category2vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;

/**
 * @author coder_ccy
 * @date 2022/3/21 11:48
 */

@Controller
public class IndexController {

    @Autowired
    private CategoryService categoryService;



    // 首页跳转
    @GetMapping({"","index.html"})
    public String index(HttpSession session){

        LoginInfo loginInfo = (LoginInfo) session.getAttribute("loginInfo");
        System.out.println(loginInfo);

        return "index";
    }

    @GetMapping("jsonweb/cateloglistjson")
    @ResponseBody
    public HashMap<String, List<Category2vo>> cateloglistjson(){

        return categoryService.cateloglistjsonredis();

    }
}
